#ifndef     CONTROLLER_2018
#define     CONTROLLER_2018

namespace PERSONAL_TASK
{
    enum UID
    {
        KEYDOWN_W,
        KEYDOWN_A,
        KEYDOWN_S,
        KEYDOWN_D,
        KEYUP_W,
        KEYUP_A,
        KEYUP_S,
        KEYUP_D,
    };
}

//interface: if uid(unique id) is your quest ,do something with the data
//it's use for every thing,but your'd better not use this
/*  example:
#define EAT     0
#define DANCE   1
#define SING    2

typedef int Food;
Food apple = 0;
Food banana = 1;

class Dancer
{
public:
    void dance(){printf("dancing!\n");}
};


class DancerController : public Controller
{
public:
    DancerController(Dancer* dancer,bool del = true):
        d(dancer),
        autodelete(del)
    {

    }

    ~DancerController()
    {
        if(autodelete){delete d;}
    }

private:
    Dancer* d;
    bool autodelete;
public:
    virtual void quest(int uid,void* data = 0)override
    {
        switch(uid)
        {
            case EAT:
                [=](void){
                    if(data == 0){return;} Food food = *((Food*)data);if(food != apple){printf("dancer don't like this food! no eat!\n");return;}
                    printf("dancer happy to eat apple!\n");
                }();
                break;
            case DANCE:
                d->dance();
                break;
            default:
            printf("none of my business!\n");
        }
    }
};

DancerController dc(new Dancer());
dc.quest(SING);
dc.quest(DANCE);
dc.quest(EAT,&apple);
dc.quest(EAT,&banana);
*/

class Controller
{
public:
    virtual ~Controller(){}

public:
    virtual void quest(int uid,void* data = 0){}
};



#endif // CONTROLLER_2018
